package wechat.base.snd.test

import org.apache.log4j.Logger
import org.eclipse.xtend.lib.Property
import org.junit.Ignore
import org.junit.Test
import wechat.base.snd.WCServiceApp
import wechat.base.snd.domain.SqrCode

class ServiceAppTest {
	static Logger logger = Logger::getLogger("ServiceAppTest")
	
	@Test
	@Ignore
	def void dslTokenTest(){
		WCServiceAppFactory4Test::serviceApp=>[
			logger.info(token)
		]
	}

	@Test
	@Ignore
	def void dslNewQRCodeTest(){
		SqrCode::getSqrcodeFile(WCServiceAppFactory4Test::serviceApp,"testcustomer")	
	}
	
	//https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=
	
	@Property String id 
	
//	@Test
//	@Ignore
//	def void dslNewDepartmentTest(){
//		DepartmentManager::departmentManager=>[
//			val d = new Department('客户1111', '1')
//			addDepartment(d)=>[
//				if (it) {
//					this.id = d.id 
//					logger.info('id is '+ this.id)
//				}
//			]
//		]
//	}
//	o9w_ht7bop9O2Ftn80x3UC2GynEY  --rock openid
//	@Test
//	@Ignore
//	def void dslNewContactTest(){
//		ContactManager::contactManager=>[
//			val c = new Contact('shasha_021', 'hehe')=>[
//				department = '8'
//			]
//			addContact(c)=>[
//				print("*************"+ it.errcode)
//				print("*************"+ it.errmsg)
//			]
//		]
//	}
//	@Test
//	@Ignore
//	def void dslSndTemplateMsgTest(){
//		ScheduledTaskNotify::sendTemplateMsg_ServApp(newArrayList('o9w_ht7bop9O2Ftn80x3UC2GynEY'),'609',new Date(), 'zhangsan','huohu')
//	}
//	@Test
//	@Ignore
//	def void dslSndTemplateMsgTestNoAuth(){
//		ScheduledTaskNotify::sendTemplateMsg_ServApp_NoAuth(newArrayList('o9w_ht7bop9O2Ftn80x3UC2GynEY'),'609',new Date(), 'noauth','huohu')
//	}
//	
//	@Test
//	@Ignore
//	def void sndTempMsgExtTest(){
//		ScheduledTaskNotify::sendTemplateMsg_ServApp_NoAuth_ext('o9w_ht7bop9O2Ftn80x3UC2GynEY','609',new Date(), 'zhangsan','junit test')
//	}
	
}

class WCServiceAppFactory4Test{
//	private static WCServiceApp serviceApp = new WCServiceApp('wx4bfa441f37c72005','2ac3ac52493c8ce7fbf53636a19baef9')
	private static WCServiceApp serviceApp = new WCServiceApp('wxb9e84ff7c7d73b5a','3930113ad0d753ca3fa031af97f38a5c')//jinshan
	
	def static getServiceApp(){
		serviceApp
	}
}